from django.contrib import admin
from detlefschneider.gallery.models import Category, GalleryImage, GalleryVideo, Gallery

class CategoryAdmin(admin.ModelAdmin):
    list_display = ('name', 'ordering',)
    list_editable = ('ordering',)     
    prepopulated_fields = {'slug': ('name',)}

class GalleryImageInline(admin.StackedInline):
    model = GalleryImage

class GalleryVideoInline(admin.StackedInline):
    model = GalleryVideo
    extra = 1

class GalleryAdmin(admin.ModelAdmin):
    list_display = ('name', 'ordering',)
    list_editable = ('ordering',)    
    prepopulated_fields = {'slug': ('name',)}

    inlines = [
        GalleryImageInline,
        GalleryVideoInline,
    ]

admin.site.register(Category, CategoryAdmin)
admin.site.register(Gallery, GalleryAdmin)